package com.asiainfo_linkage.message;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.asiainfo_linkage.model.AddMember;
import com.asiainfo_linkage.model.RemTask;
import com.asiainfo_linkage.utils.MailUtil;

/**
 * 邮件消息提醒发送。
 * @author Administrator
 *
 */
public class EmailSender implements MessageSender{

	@Override
	public void send(RemTask remTask, List<AddMember> receivers) {
		if(remTask==null || receivers==null || receivers.size()==0)
			return;
		//批量发送邮件。
		for(AddMember member:receivers){
			Map<String,Object> mailMap = new HashMap<String,Object>();
			mailMap.put("toEmail", member.getMEMBER_EMAIL());
		    mailMap.put("subject", remTask.getTask_name());
		    mailMap.put("mailContent", remTask.getRem_content());
			try {
				MailUtil.sendMail(mailMap);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
	
}
